
***********************************************************************************************
***1. LOAD AND SET UP DATA
***********************************************************************************************

**This analysis uses the Integrated 2017-2022 WVS and EVS dataset (Version 4.0.0) found at: https://search.gesis.org/research_data/ZA7505

use [path to data]

**Start by dropping all the non-relevant cases and creating the Partisan in Power Variable
	gen case = 0
	gen partisaninpower = 0
	gen countrynumber = 0
	

	**Albania
	replace case = 1 if cntry_y==82018
	gen albania = 0
	replace albania = 1 if cntry_y==82018
	replace countrynumber = 1 if albania==1
	replace partisaninpower = 1 if E181_EVS5==802
	replace partisaninpower = 1 if E181_EVS5==803
	replace partisaninpower = 1 if E181_EVS5==811
	
	**Andorra
	replace case = 1 if cntry_y==202018
	gen andorra = 0
	replace andorra = 1 if cntry_y==202018
	replace countrynumber = 2 if andorra==1
	replace partisaninpower = 1 if E179_WVS7==20008
	
	**Argentina
	replace case = 1 if cntry_y==322017
	gen argentina = 0
	replace argentina = 1 if cntry_y==322017
	replace countrynumber = 3 if argentina==1
	replace partisaninpower = 1 if E179_WVS7==32009
	replace partisaninpower = 1 if E179_WVS7==32105

	**Armenia
	replace case = 1 if cntry_y==512021
	gen armenia = 0
	replace armenia = 1 if cntry_y==512021
	replace countrynumber = 4 if armenia==1
	replace partisaninpower = 1 if E179_WVS7== 51035
	replace partisaninpower = 1 if E179_WVS7== 51036
	
	**Australia
	replace case = 1 if cntry_y==362018
	gen australia = 0
	replace australia = 1 if cntry_y==362018
	replace countrynumber = 5 if australia==1
	replace partisaninpower = 1 if E179_WVS7==36002
	replace partisaninpower = 1 if E179_WVS7==36003
	
	**Austria
	replace case = 1 if cntry_y==402018
	gen austria = 0
	replace austria = 1 if cntry_y==402018
	replace countrynumber = 6 if austria==1
	replace partisaninpower = 1 if E181_EVS5==4002
	replace partisaninpower = 1 if E181_EVS5==4003

	**Azerbaijan
	replace case = 1 if cntry_y==312018
	gen azerbaijan = 0
	replace azerbaijan = 1 if cntry_y==312018
	replace countrynumber = 7 if azerbaijan==1
	replace partisaninpower = 1 if E181_EVS5==3101
	
	**Bangladesh
	replace case = 1 if cntry_y==502018
	gen bangladesh = 0
	replace bangladesh = 1 if cntry_y==502018
	replace countrynumber = 8 if bangladesh==1
	replace partisaninpower = 1 if E179_WVS7==50001
	replace partisaninpower = 1 if E179_WVS7==50002
	
	**Bolivia
	replace case = 1 if cntry_y==682017
	gen bolivia = 0
	replace bolivia = 1 if cntry_y==682017
	replace countrynumber = 9 if bolivia==1
	replace partisaninpower = 1 if E179_WVS7==68001
	
	**Bosnia and Herzegovina
	replace case = 1 if cntry_y==702019
	gen bosniaandherzegovina = 0
	replace bosniaandherzegovina = 1 if cntry_y==702019
	replace countrynumber = 10 if bosniaand==1
	
	replace partisaninpower = 1 if E181_EVS5==7012
	replace partisaninpower = 1 if E181_EVS5==7017
	replace partisaninpower = 1 if E181_EVS5==7016
	replace partisaninpower = 1 if E181_EVS5==7013
	
	
	**Brazil
	replace case = 1 if cntry_y==762018
	gen brazil = 0
	replace brazil = 1 if cntry_y==762018
	replace countrynumber = 11 if brazil==1
	replace partisaninpower = 1 if E179_WVS7==76002
	replace partisaninpower = 1 if E179_WVS7==76001
	replace partisaninpower = 1 if E179_WVS7==76004
	replace partisaninpower = 1 if E179_WVS7==76005
	replace partisaninpower = 1 if E179_WVS7==76003
	
	**Bulgaria
	replace case = 1 if cntry_y==1002017
	gen bulgaria = 0
	replace bulgaria = 1 if cntry_y==1002017
	replace countrynumber = 12 if bulgaria==1
	replace partisaninpower = 1 if E181_EVS5==10001
	replace partisaninpower = 1 if E181_EVS5==10015
	
	**Canada
	replace case = 1 if cntry_y==1242020
	gen canada = 0
	replace canada = 1 if cntry_y==1242020
	replace countrynumber = 13 if canada==1
	replace partisaninpower = 1 if E179_WVS7== 124001
	
	**Chile
	replace case = 1 if cntry_y==1522018
	gen chile = 0
	replace chile = 1 if cntry_y==1522018
	replace countrynumber = 14 if chile==1
	replace partisaninpower = 1 if E179_WVS7==152002
	replace partisaninpower = 1 if E179_WVS7==152001
	replace partisaninpower = 1 if E179_WVS7==152029
	
	**Colombia
	replace case = 1 if cntry_y==1702018
	gen colombia = 0
	replace colombia = 1 if cntry_y==1702018
	replace countrynumber = 15 if colombia==1
	replace partisaninpower = 1 if E179_WVS7==170021
	replace partisaninpower = 1 if E179_WVS7==170001
	replace partisaninpower = 1 if E179_WVS7==170004
	
	**Croatia
	replace case = 1 if cntry_y==1912017
	gen croatia = 0
	replace croatia = 1 if cntry_y==1912017
	replace countrynumber = 16 if croatia==1
	replace partisaninpower = 1 if E181_EVS5==19102
	replace partisaninpower = 1 if E181_EVS5==19113
	
	**Cyprus
	replace case = 1 if cntry_y==1962019
	gen cyprus = 0
	replace cyprus = 1 if cntry_y==1962019
	replace countrynumber = 17 if cyprus==1
	replace partisaninpower = 1 if E179_WVS7==196002
	replace partisaninpower = 1 if E179_WVS7==196010
	
	**Czechia
	replace case = 1 if cntry_y==2032017
	gen czechia = 0
	replace czechia = 1 if cntry_y==2032017
	replace countrynumber = 18 if czechia==1
	replace partisaninpower = 1 if E181_EVS5==20301
	replace partisaninpower = 1 if E181_EVS5==20302
	
	
	**Denmark
	replace case = 1 if cntry_y==2082017
	gen denmark = 0
	replace denmark = 1 if cntry_y==2082017
	replace countrynumber = 19 if denmark==1
	replace partisaninpower = 1 if E181_EVS5==20807
	replace partisaninpower = 1 if E181_EVS5==20808
	replace partisaninpower = 1 if E181_EVS5==20805
	
	**Ecuador
	replace case = 1 if cntry_y==2182018
	gen ecuador = 0
	replace ecuador = 1 if cntry_y==2182018
	replace countrynumber = 20 if ecuador==1
	replace partisaninpower = 1 if E179_WVS7==218001
	
	**Estonia
	replace case = 1 if cntry_y==2332018
	gen estonia = 0
	replace estonia = 1 if cntry_y==2332018
	replace countrynumber = 21 if estonia==1
	replace partisaninpower = 1 if E181_EVS5==23302
	replace partisaninpower = 1 if E181_EVS5==23303
	replace partisaninpower = 1 if E181_EVS5==23304
	
	**Ethiopia
	replace case = 1 if cntry_y==2312020
	gen ethiopia = 0
	replace ethiopia = 1 if cntry_y==2312020
	replace countrynumber = 22 if ethiopia==1
	replace partisaninpower = 1 if E179_WVS7==231028
	replace partisaninpower = 1 if E179_WVS7==231005
	
	**Finland
	replace case = 1 if cntry_y==2462017
	gen finland = 0
	replace finland = 1 if cntry_y==2462017
	replace countrynumber = 23 if finland==1 
	replace partisaninpower = 1 if E181_EVS5==24601
	replace partisaninpower = 1 if E181_EVS5==24602
	replace partisaninpower = 1 if E181_EVS5==24608
	
	**France
	replace case = 1 if cntry_y==2502018
	gen france = 0
	replace france = 1 if cntry_y==2502018
	replace countrynumber = 24 if france==1
	replace partisaninpower = 1 if E181_EVS5==25008
	replace partisaninpower = 1 if E181_EVS5==25009

	**Georgia
	replace case = 1 if cntry_y==2682018
	gen georgia = 0
	replace georgia = 1 if cntry_y==2682018
	replace countrynumber = 25 if georgia==1
	replace partisaninpower = 1 if E181_EVS5==26810
	
	**Germany
	replace case = 1 if cntry_y==2762017
	replace case = 1 if cntry_y==2762018
	gen germany = 0
	replace germany = 1 if cntry_y==2762017
	replace germany = 1 if cntry_y==2762018
	replace countrynumber = 26 if germany==1
	replace partisaninpower = 1 if E179_WVS7==276001
	replace partisaninpower = 1 if E179_WVS7==276002
	replace partisaninpower = 1 if E181_EVS5==27601
	replace partisaninpower = 1 if E181_EVS5==27602
	
	**Great Britain
	replace case = 1 if cntry_y==8262018
	gen greatbritain = 0
	replace greatbritain = 1 if cntry_y==8262018
	replace countrynumber = 27 if greatbritain==1
	replace partisaninpower = 1 if E181_EVS5==82601
	
	replace case = 1 if cntry_y==8262022
	replace greatbritain = 1 if cntry_y==8262022
	replace countrynumber = 27 if greatbritain==1
	replace partisaninpower = 1 if E179_WVS7==826001
	
	**Greece
	replace case = 1 if cntry_y==3002017
	gen greece = 0
	replace greece = 1 if cntry_y==3002017
	replace countrynumber = 28 if greece==1
	replace partisaninpower = 1 if E179_WVS7==300110

	
	**Guatemala
	replace case = 1 if cntry_y==3202020
	gen guatemala = 0
	replace guatemala = 1 if cntry_y==3202020
	replace countrynumber = 29 if guatemala
	replace partisaninpower = 1 if E179_WVS7==320006
	
	**HongKong
	replace case = 1 if cntry_y==3442018
	gen hongkong = 0
	replace hongkong = 1 if cntry_y==3442018
	replace countrynumber = 30 if hongkong==1
	replace partisaninpower = 1 if E179_WVS7==344004
	replace partisaninpower = 1 if E179_WVS7==344030
	replace partisaninpower = 1 if E179_WVS7==344009
	
	**Hungary
	replace case = 1 if cntry_y==3482018
	gen hungary = 0
	replace hungary = 1 if cntry_y==3482018
	replace countrynumber = 31 if hungary==1
	replace partisaninpower = 1 if E181_EVS5==34802
	replace partisaninpower = 1 if E181_EVS5==34803
	
	**Indonesia
	replace case = 1 if cntry_y==3602018
	gen indonesia = 0
	replace indonesia = 1 if cntry_y==3602018
	replace countrynumber = 32 if indonesia==1
	replace partisaninpower = 1 if E179_WVS7==360007
	replace partisaninpower = 1 if E179_WVS7==360003
	replace partisaninpower = 1 if E179_WVS7==360004
	replace partisaninpower = 1 if E179_WVS7==360017
	replace partisaninpower = 1 if E179_WVS7==360014

	**Iran
	replace case = 1 if cntry_y==3642020
	gen iran = 0
	replace iran = 1 if cntry_y==3642020
	replace countrynumber = 33 if iran==1
	replace partisaninpower = 1 if E179_WVS7==364012
	
	**Italy
	replace case = 1 if cntry_y==3802018
	gen italy = 0
	replace italy = 1 if cntry_y==3802018
	replace countrynumber = 34 if italy==1
	replace partisaninpower = 1 if E181_EVS5==38009
	replace partisaninpower = 1 if E181_EVS5==38013
	
	**Japan
	replace case = 1 if cntry_y==3922019
	gen japan = 0
	replace japan = 1 if cntry_y==3922019
	replace countrynumber = 35 if japan==1
	replace partisaninpower = 1 if E179_WVS7==392001
	replace partisaninpower = 1 if E179_WVS7==392003

	**Kazakhstan
	replace case = 1 if cntry_y==3982018
	gen kazakhstan = 0
	replace kazakhstan = 1 if cntry_y==3982018
	replace countrynumber = 36 if kazakhstan==1
	replace partisaninpower = 1 if E179_WVS7==398008
	replace partisaninpower = 1 if E179_WVS7==398005
	replace partisaninpower = 1 if E179_WVS7==398003
	
	**Kenya
	replace case = 1 if cntry_y==4042021
	gen kenya = 0
	replace kenya = 1 if cntry_y==4042021
	replace countrynumber = 37 if kenya==1
	replace partisaninpower = 1 if E179_WVS7== 404005
	replace partisaninpower = 1 if E179_WVS7== 404006
	replace partisaninpower = 1 if E179_WVS7== 404018
	
	**Kyrgyzstan
	replace case = 1 if cntry_y==4172020
	gen kyrgyzstan = 0
	replace kyrgyzstan = 1 if cntry_y==4172020
	replace countrynumber = 38 if kyrgyzstan==1
	replace partisaninpower = 1 if E179_WVS7==417038
	replace partisaninpower = 1 if E179_WVS7==417039
	replace partisaninpower = 1 if E179_WVS7==417111
	replace partisaninpower = 1 if E179_WVS7==417105
	replace partisaninpower = 1 if E179_WVS7==417106

	**Latvia
	replace case = 1 if cntry_y==4282021
	gen latvia = 0
	replace latvia = 1 if cntry_y==4282021
	replace countrynumber = 39 if latvia==1
	replace partisaninpower = 1 if E181_EVS5 == 42807
	replace partisaninpower = 1 if E181_EVS5 == 42803
	replace partisaninpower = 1 if E181_EVS5 == 42804		
	replace partisaninpower = 1 if E181_EVS5 == 42802	
	replace partisaninpower = 1 if E181_EVS5 == 42805
	
	**Lebanon
	replace case = 1 if cntry_y==4222018
	gen lebanon = 0
	replace lebanon = 1 if cntry_y==4222018
	replace countrynumber = 40 if lebanon==1
	
	replace partisaninpower = 1 if E179_WVS7==422001
	replace partisaninpower = 1 if E179_WVS7==422002
	replace partisaninpower = 1 if E179_WVS7==422004
	replace partisaninpower = 1 if E179_WVS7==422005
	replace partisaninpower = 1 if E179_WVS7==422018
	
	**Lithuania
	replace case = 1 if cntry_y==4402018
	gen lithuania = 0
	replace lithuania = 1 if cntry_y==4402018
	replace countrynumber = 41 if lithuania==1
	
	replace partisaninpower = 1 if E181_EVS5==44007
	replace partisaninpower = 1 if E181_EVS5==44006
	replace partisaninpower = 1 if E181_EVS5==44001
	replace partisaninpower = 1 if E181_EVS5==44004
	
	
	*Maldives
	replace case = 1 if cntry_y==4622021
	gen maldives = 0
	replace maldives = 1 if cntry_y==4622021
	replace countrynumber = 42 if maldives==1
	replace partisaninpower = 1 if E179_WVS7== 462002
	
	
	**Mexico
	replace case = 1 if cntry_y==4842018
	gen mexico = 0
	replace mexico = 1 if cntry_y==4842018
	replace countrynumber = 43 if mexico==1
	replace partisaninpower = 1 if E179_WVS7==484001
	replace partisaninpower = 1 if E179_WVS7==484005
	
	**Montenegro
	replace case = 1 if cntry_y==4992019
	gen montenegro = 0
	replace montenegro = 1 if cntry_y==4992019
	replace countrynumber = 44 if montenegro==1
	replace partisaninpower = 1 if E181_EVS5==49901
		
	*Morocco (2021 election not in V-Party. Manually coded by author)
	replace case = 1 if cntry_y==5042021
	gen morocco = 0
	replace morocco = 1 if cntry_y==5042021
	replace countrynumber = 45 if morocco==1
	replace partisaninpower = 1 if E179_WVS7== 504004
	replace partisaninpower = 1 if E179_WVS7== 504002
	replace partisaninpower = 1 if E179_WVS7== 504011
	
	**Myanmar
	replace case = 1 if cntry_y==1042020
	gen myanmar = 0
	replace myanmar = 1 if cntry_y==1042020
	replace countrynumber = 46 if myanmar==1
	replace partisaninpower = 1 if E179_WVS7==104001
	
	**Netherlands
	replace case = 1 if cntry_y==5282017
	gen netherlands = 0
	replace netherlands = 1 if cntry_y==5282017
	replace countrynumber = 47 if netherlands==1
	replace partisaninpower = 1 if E181_EVS5==52801
	replace partisaninpower = 1 if E181_EVS5==52804
	replace partisaninpower = 1 if E181_EVS5==52803
	replace partisaninpower = 1 if E181_EVS5==52808
	
	replace case = 1 if cntry_y==5282022
	replace netherlands = 1 if cntry_y==5282022
	replace countrynumber = 47 if netherlands==1
	replace partisaninpower = 1 if E179_WVS7==528003
	replace partisaninpower = 1 if E179_WVS7==528004	
	replace partisaninpower = 1 if E179_WVS7==528002	
	replace partisaninpower = 1 if E179_WVS7==528014	
	
	**New Zealand
	replace case = 1 if cntry_y==5542020
	gen newzealand = 0
	replace newzealand = 1 if cntry_y==5542020
	replace countrynumber = 48 if newzealand==1
	replace partisaninpower = 1 if E179_WVS7==554005
	replace partisaninpower = 1 if E179_WVS7==554007
	replace partisaninpower = 1 if E179_WVS7==554004
	
	**Nicaragua
	replace case = 1 if cntry_y==5582020
	gen nicaragua = 0
	replace nicaragua = 1 if cntry_y==5582020
	replace countrynumber = 49 if nicaragua==1
	replace partisaninpower = 1 if E179_WVS7==558001

	**Nigeria
	replace case = 1 if cntry_y==5662018
	gen nigeria = 0
	replace nigeria = 1 if cntry_y==5662018
	replace countrynumber = 50 if nigeria==1
	replace partisaninpower = 1 if E179_WVS7==566021
	
	**North Macedonia 
	replace case = 1 if cntry_y==8072019
	gen northmacedonia = 0
	replace northmacedonia = 1 if cntry_y==8072019
	replace countrynumber = 51 if northmacedonia==1
	
	replace partisaninpower = 1 if E181_EVS5==80716
	replace partisaninpower = 1 if E181_EVS5==80709
	replace partisaninpower = 1 if E181_EVS5==80711
	replace partisaninpower = 1 if E181_EVS5==80710
	replace partisaninpower = 1 if E181_EVS5==80715
	replace partisaninpower = 1 if E181_EVS5==80708
	replace partisaninpower = 1 if E181_EVS5==80703
	
	
	**Norway
	replace case = 1 if cntry_y==5782018
	gen norway = 0
	replace norway = 1 if cntry_y==5782018
	replace countrynumber = 52 if norway==1
	replace partisaninpower = 1 if E181_EVS5==57804
	replace partisaninpower = 1 if E181_EVS5==57803
	replace partisaninpower = 1 if E181_EVS5==57805
	replace partisaninpower = 1 if E181_EVS5==57813

	**Pakistan
	replace case = 1 if cntry_y==5862018
	gen pakistan = 0
	replace pakistan = 1 if cntry_y==5862018
	replace countrynumber = 53 if pakistan==1
	replace partisaninpower = 1 if E179_WVS7==586007
	
	**Philippines
	replace case = 1 if cntry_y==6082019
	gen philippines = 0
	replace philippines = 1 if cntry_y==6082019
	replace countrynumber = 54 if philippines==1
	
	replace partisaninpower = 1 if E179_WVS7==608005
	
	replace partisaninpower = 1 if E179_WVS7==608003
	replace partisaninpower = 1 if E179_WVS7==608034	

	replace partisaninpower = 1 if E179_WVS7==608004

	**Poland
	replace case = 1 if cntry_y==6162017
	gen poland = 0
	replace poland = 1 if cntry_y==6162017
	replace countrynumber = 55 if poland==1
	replace partisaninpower = 1 if E181_EVS5==61601
	
	**Portugal
	replace case = 1 if cntry_y==6202020
	gen portugal = 0
	replace portugal = 1 if cntry_y==6202020
	replace countrynumber = 56 if portugal==1
	replace partisaninpower = 1 if E181_EVS5==62007
	
	**Puerto Rico
	replace case = 1 if cntry_y==6302018
	gen puertorico = 0
	replace puertorico = 1 if cntry_y==6302018
	replace countrynumber = 57 if puertorico==1
	replace partisaninpower = 1 if E179_WVS7==630001
	
	**Romania
	replace case = 1 if cntry_y==6422018
	gen romania = 0
	replace romania = 1 if cntry_y==6422018
	replace countrynumber = 58 if romania==1
	replace partisaninpower = 1 if E179_WVS7==642008
	replace partisaninpower = 1 if E181_EVS5==64201
	replace partisaninpower = 1 if E179_WVS7==642066
	replace partisaninpower = 1 if E181_EVS5==64204
	replace partisaninpower = 1 if E179_WVS7==642006
	replace partisaninpower = 1 if E181_EVS5==64206
	
	**Russia
	replace case = 1 if cntry_y==6432017
	gen russia = 0
	replace russia = 1 if cntry_y==6432017
	replace countrynumber = 59 if russia==1
	replace partisaninpower = 1 if E179_WVS7==643032
	replace partisaninpower = 1 if E179_WVS7==643003
	replace partisaninpower = 1 if E179_WVS7==643034
	replace partisaninpower = 1 if E181_EVS5==64304
	replace partisaninpower = 1 if E181_EVS5==64307
	replace partisaninpower = 1 if E181_EVS5==64314	
	
	
	**Serbia
	replace case = 1 if cntry_y==6882017
	replace case = 1 if cntry_y==6882018	
	gen serbia = 0
	replace serbia = 1 if cntry_y==6882017
	replace serbia = 1 if cntry_y==6882018
	replace countrynumber = 60 if serbia==1
	
	replace partisaninpower = 1 if E179_WVS7==688002
	
	replace partisaninpower = 1 if E179_WVS7==688003
	
	replace partisaninpower = 1 if E181_EVS5==68801
	replace partisaninpower = 1 if E181_EVS5==68813
	
	replace partisaninpower = 1 if E181_EVS5==68810
	replace partisaninpower = 1 if E181_EVS5==68814
	
	
	**Slovakia
	replace case = 1 if cntry_y==7032017
	gen slovakia = 0
	replace slovakia = 1 if cntry_y==7032017
	replace countrynumber = 61 if slovakia==1
	replace partisaninpower = 1 if E181_EVS5==70310
	replace partisaninpower = 1 if E181_EVS5==70308
	replace partisaninpower = 1 if E181_EVS5==70304
	replace partisaninpower = 1 if E181_EVS5==70306
		
	*Note the political party in power changed between survey waves. Coded accordingly.
	*2020 election not in V-party. Manually coded by author.
	replace case = 1 if cntry_y==7032022
	replace slovakia = 1 if cntry_y==7032022
	replace countrynumber = 61 if slovakia==1
	replace partisaninpower = 1 if E179_WVS7==703047
	replace partisaninpower = 1 if E179_WVS7==703050
	replace partisaninpower = 1 if E179_WVS7==703053
	replace partisaninpower = 1 if E179_WVS7==703049
	
	**Slovenia
	replace case = 1 if cntry_y==7052017
	gen slovenia = 0
	replace slovenia = 1 if cntry_y==7052017
	replace countrynumber = 62 if slovenia==1
	replace partisaninpower = 1 if E181_EVS5==70501
	replace partisaninpower = 1 if E181_EVS5==70504
	replace partisaninpower = 1 if E181_EVS5==70503	
	
	**South Korea
	replace case = 1 if cntry_y==4102018
	gen southkorea = 0
	replace southkorea = 1 if cntry_y==4102018
	replace countrynumber = 63 if southkorea==1
	replace partisaninpower = 1 if E179_WVS7==410002
	
	**SPAIN
	replace case = 1 if cntry_y==7242017
	gen spain = 0
	replace spain = 1 if cntry_y==7242017
	replace countrynumber = 64 if spain==1
	replace partisaninpower = 1 if E181_EVS5==72402
	replace partisaninpower = 1 if E181_EVS5==72409
	
	**Sweden
	replace case = 1 if cntry_y==7522017
	gen sweden = 0
	replace sweden = 1 if cntry_y==7522017
	replace countrynumber = 65 if sweden==1
	replace partisaninpower = 1 if E181_EVS5==75201
	replace partisaninpower = 1 if E181_EVS5==75207
	
	**Switzerland
	replace case = 1 if cntry_y==7562017
	gen switzerland = 0
	replace switzerland = 1 if cntry_y==7562017
	replace countrynumber = 66 if switzerland==1
	
	replace partisaninpower = 1 if E181_EVS5==75603
	replace partisaninpower = 1 if E181_EVS5==75604
	replace partisaninpower = 1 if E181_EVS5==75601
	replace partisaninpower = 1 if E181_EVS5==75602

	**Taiwan
	replace case = 1 if cntry_y==1582019
	gen taiwan = 0
	replace taiwan = 1 if cntry_y==1582019
	replace countrynumber = 67 if taiwan==1
	replace partisaninpower = 1 if E179_WVS7==158002
	replace partisaninpower = 1 if E179_WVS7==158013

	**Tajikistan
	replace case = 1 if cntry_y==7622020
	gen tajikistan = 0
	replace tajikistan = 1 if cntry_y==7622020
	replace countrynumber = 68 if tajikistan==1
	replace partisaninpower = 1 if E179_WVS7==762001
	
	**Tunisia
	replace case = 1 if cntry_y==7882019
	gen tunisia = 0
	replace tunisia = 1 if cntry_y==7882019
	replace countrynumber = 69 if tunisia==1
	replace partisaninpower = 1 if E179_WVS7==788022
	replace partisaninpower = 1 if E179_WVS7==788012	

	
	**Ukraine
	replace case = 1 if cntry_y==8042020
	gen ukraine = 0
	replace ukraine = 1 if cntry_y==8042020
	replace countrynumber = 70 if ukraine==1
	replace partisaninpower = 1 if E181_EVS5==80401
	replace partisaninpower = 1 if E179_WVS7==804218
	
	**United States
	replace case = 1 if cntry_y==8402017
	gen unitedstates = 0
	replace unitedstates = 1 if cntry_y==8402017
	replace countrynumber = 71 if unitedstates==1
	replace partisaninpower = 1 if E179_WVS7==840001
	
	**Uruguay
	replace case = 1 if cntry_y==8582022
	gen uruguay=0
	replace uruguay = 1 if cntry_y==8582022
	replace countrynumber = 72 if uruguay==1
	replace partisaninpower = 1 if E179_WVS7==858002
	replace partisaninpower = 1 if E179_WVS7==858001
	
	**Venezuela
	replace case = 1 if cntry_y==8622021
	gen venezuela=0
	replace venezuela = 1 if cntry_y==8622021
	replace countrynumber = 73 if venezuela==1
	replace partisaninpower = 1 if E179_WVS7==862031

	**Zimbabwe
	replace case = 1 if cntry_y==7162020
	gen zimbabwe = 0
	replace zimbabwe = 1 if cntry_y==7162020
	replace countrynumber = 74 if zimbabwe==1
	replace partisaninpower = 1 if E179_WVS7==716027
	
***ENDCASES
	
	drop if case == 0

***CONTROLS
	*age
	
	gen age = 0 
	replace X003= . if X003<.5
	replace age = X003
	
	gen male = 0
	replace male = 1 if X001==1
	
	gen married = 0
	replace married = 1 if X007==1
	
	gen parent = 0
	replace parent = 1 if X011>0.5
	
	gen loweredu = 0 
	replace loweredu = 1 if X025R == 1
	
	gen middleedu = 0 
	replace middleedu = 1 if X025R == 2
	
	gen higheredu = 0 
	replace higheredu = 1 if X025R == 3

	gen employed = 0
	replace employed = 1 if X028==1
	replace employed = 1 if X028==2
	replace employed = 1 if X028==3
	
	gen unemployed = 0
	replace unemployed = 1 if X028==7
	
	gen satisfiedwithpolsystem = 0
	replace E111_01 = . if E111_01<.5
	replace satisfiedwithpolsystem = E111_01
	
	
*DVs

gen explicitsupport = 0

replace E117 = . if E117<.5
replace E235 = . if E235<.5

	*need to invert E117 so higher values are the more democratic response. This also makes it range from 0-3.
	gen inverseE117 = 0
	replace inverseE117 = 4 - E117 
	
	gen scaledE235 = 0
	replace scaledE235 = (E235-1) / 3

replace explicitsupport = scaledE235 + inverseE117

	
gen rejectantidem = 0

replace E114 = . if E114<.5
replace E116 = . if E116<.5

replace rejectantidem = (E114 + E116 - 2) 

gen deemphasizeorder = 0
replace deemphasizeorder = 1 if E003!=1
replace deemphasizeorder = . if E003<.5

replace E229 = . if E229<-.5
replace E233B = . if E233B<-.5

gen conceptualizationscale = E229 - E233B


svyset [pweight=gwght]


***********************************************************************************************
***2. Main Models
***********************************************************************************************

**Table 1 in main article

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)

mixed rejectantidem i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)

melogit deemphasizeorder i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)

margins, dydx(*) post
**YThe margins command works, but it's very strenuous on the computer.

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed  [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)


**FOOTNOTE 5: Checking satisfaction with the way pol system works. These are the unreported models reference in Footnote 5.

mixed satisfiedwithpolsystem i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)

mixed explicitsupport i.partisaninpower satisfiedwithpolsystem age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)

***********************************************************************************************
***3. APPENDIX DESCRIPTIVE STATISTICS AND MODELS
***********************************************************************************************

**Appendix C1: Descriptive Statistics, Dependent Variables

svy: mean explicits rejectanti deemphasize conceptualization
sum explicitsupport rejectanti deemphasize conceptualizationsc

**Appendix C2: Descriptive Statistics, Independent variables
svy: mean partisaninpower age male married parent loweredu higheredu employ unempl
sum partisaninpower age male married parent loweredu higheredu employ unempl

**Appendix D1: Beta Coefficients

	**Beta regs. Note here that you can't run mixed command with the beta regs, so innstead of a multi-level model it's a linear/logit regression with dummy variables for countries. NOTE: use the bstdxy as the fully standardize coefficient.

reg explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed i.countrynumber [pweight=gwght], beta

reg rejectantidem i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed i.countrynumber [pweight=gwght], beta

logit deemphasizeorder i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed i.countrynumber [pweight=gwght]
listcoef, std

reg conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed i.countrynumber [pweight=gwght], beta

**Appendix D2: Coefficients on Partisan in Power by country. 

**Getting country specific coefficients
sort countrynumber
by countrynumber: reg explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber<40
by countrynumber: reg explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber>39.5

by countrynumber: reg rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber<40
by countrynumber: reg rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber>39.5

by countrynumber: reg conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber<40
by countrynumber: reg conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if countrynumber>39.5

**APPENDIX D3 pulls from V-Dem data found at: https://www.v-dem.net/data/
	
**SETTING UP EXTENSIONS. First bring in the VDEM country-level variables. I did this manually and put them in a separate .dta file.

merge m:1 countrynumber using [path to dataset], keepusing(v2x_libdem democchange polarization top20) generate(_merge2)

**Note: Andorra and PR missing, so the regressions exclude them. I manually calculated the halfway cutoff for eachh variable. Halfway cutoff for libdem is .55 ; polarization is .1 ; backsliding is -.014

**Appendix D4: Least democratic
mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if v2x_libdem < .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght]  if v2x_libdem < .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if v2x_libdem < .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

**Appendix D5: Most democratic
mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if v2x_libdem > .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured) 

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if v2x_libdem > .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if v2x_libdem > .55 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)


**Appendix D6: Most backlsiding

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if democchange < -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght]  if democchange < -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if democchange < -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

**Appendix D7: Least Backlsiding

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if democchange > -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured) 

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if democchange > -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if democchange > -.014 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

**Appendix D8: Most polarized

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if polarization > .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured) 

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if polarization > .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)


mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if polarization > .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

**Appendix D9:  Least polarized

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if polarization < .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght]  if polarization < .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if polarization < .1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

**Appendix D10: 10 most democratic and least polarized

mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if top20==1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured) 

mixed rejectanti i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if top20==1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)

mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed [pweight=gwght] if top20==1 & countrynumber!=2 & countrynumber!=57 || countrynumber: partisaninpower, covariance (unstructured)


**Appendix D11: Multiple imputation


		*Citysize not avaiable for Denmark, Netherlands, and Great Britain. As a result, I only include this variable when imputing missing values.  The data from the United States codes 1 and 2's as missing, so I had to recode to 1.
	
	gen citysize = 0
	replace citysize = 1 if size_5c<0 & countrynumber==71
	replace citysize = . if size_5c<0 & countrynumber!=71
	replace citysize = . if size_5c < 0
	
	replace citysize = 1 if size_5c==1
	replace citysize = 2 if size_5c==2
	replace citysize = 3 if size_5c==3
	replace citysize = 4 if size_5c==4
	replace citysize = 5 if size_5c==5
	
	gen paysattentiontopolitics = 0
	replace E023 = . if E023<0
	replace paysattentiontopolitics = 4 - E023
	

**Unreported models for Footnote 8. 

**Adding in citysize
mixed explicitsupport i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed citysize paysattentiontopolitics [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)
mixed rejectantidem i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed citysize paysattentiontopolitics [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)
melogit deemphasizeorder i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed citysize paysattentiontopolitics [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)
margins, dydx(*) post
mixed conceptualization i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed citysize paysattentiontopolitics [pweight=gwght] || countrynumber: partisaninpower, covariance (unstructured)


*Need to convert specific missing values (DK's versus no answer) to just normal missing before imputing the data.

mi set mlong

mi misstable sum E117 E235 E114 E116 E229 E233B partisaninpower age male married parent loweredu higheredu employed unemployed paysattentiontopolitics citysize 

mi misstable patterns E117 E235 E114 E116 E229 E233B partisaninpower age male married parent loweredu higheredu employed unemployed

mi register imputed  E117 E235 E114 E116 E229 E233B age paysattentiontopolitics citysize

mi impute mvn E117 E235 E114 E116 E229 E233B age paysattentiontopolitics citysize =  i.partisaninpower i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed i.countrynumber, add(10) rseed (1234)

mi passive: generate impexplicit = (4-E117) + ((E235-1)/3)
mi passive: generate imprejectantidem = E114 + E116 - 2
mi passive: generate impconceptscale = E229 - E233B

mi estimate: mixed impexplicit i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed || countrynumber: partisaninpower, covariance (unstructured)

mi estimate: mixed imprejectantidem i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed || countrynumber: partisaninpower, covariance (unstructured)

mi estimate: mixed impconceptscale i.partisaninpower age i.male i.married i.parent i.loweredu i.higheredu i.employed i.unemployed || countrynumber: partisaninpower, covariance (unstructured)

